using LuaInterface;

namespace ArtheaEngine
{
    partial class Script
    {
    }

    public class CharacterScriptWrapper
    {
        private readonly Character ch;

        public CharacterScriptWrapper(Character ch)
        {
            this.ch = ch;
        }

        public string Name
        {
            get { return ch.Name; }
        }

        public short Level
        {
            get { return ch.Level; }
        }
    }

    partial class CharScript
    {
        private readonly Lua engine = new Lua();

        partial void OnCreated()
        {
            engine["self"] = new CharacterScriptWrapper(Character);
        }

        public void Process(Character ch)
        {
            engine["ch"] = new CharacterScriptWrapper(ch);

            engine.DoString(Script.Code);
        }
    }

    public enum ScriptTrigger
    {
        Act,
        Entry,
        Exit,
        Greet
    }
}